/**
 * 冒泡排序
 */
public class Demo06 {
    public static void main(String[] args) {
        int[] array = {76,72,55,88,23,123,54,88,29,56};
        //分为多轮比较，外层循环控制轮数，轮数=长度-1
        for (int i = 0; i < array.length; i++) {
            //内层循环控制，进行两两比较
            for (int j = 0; j < array.length - 1 - i; j++) {
                //如果前面元素把后面大，就变换到后面
                if(array[j] > array[j + 1]);{
                    int temp = array[j];
                    array[j] = array[j + 1];
                    array[j + 1] = temp;
                }
            }
        }
        //打印所有数字组元素
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }

}
